<!-- UserController.php-->
<?php 
	require 'Model/CoModel.php';
	require 'Controller.php';
	class CoController extends Controller{
		public $model;
		function __Construct(){
			parent::__Construct();
			$this->model = new CoModel();
		}
		function cooperate(){
			$model = new CoModel();
			$data = $model->getCoList();
			//转向用户列表页面
			$this->assign('cooperate',$data);
			$this->display();
		}

		function coform(){
			//转向添加用户页面
			include 'View/Co/coform.php';
		}

		function cooedit(){
			$id = $_GET['id'];
			$model = new CoModel();
			$result = $model->getUserByID($id);
			include 'View/Co/cooedit.php';
		}

		function videosearch(){
			$videoname = $_POST['videoname'];
			$model = new VideoModel();
			$data = $model->getvideoinfor($videoname);
			include dirname(dirname(__FILE__)).'/View/video/search.php';
		}

		function coupdate(){
			$id = $_GET['id'];
			$model = new CoModel();
			$result = $model->Updateco($id);
			if($result){
				echo '修改成功'.'<a href="Admin.php?c=co&m=cooperate">如果没有跳转，请点这里跳转</a>';
				header("refresh:3;Admin.php?c=co&m=cooperate = Admin.php?c=co&m=cooperate"); 	
			}else{
				echo '失败';
			}
		}

		function delco(){
			$id = $_GET['id'];
			$model = new Comodel();
			$result = $model->Delco($id);
			if($result){
				echo '删除成功'.'<a href="Admin.php?c=co&m=cooperate">如果没有跳转，请点这里跳转</a>';
				header("refresh:3;Admin.php?c=co&m=cooperate = Admin.php?c=co&m=cooperate"); 
			}else{
				echo '删除失败';
			}
		}

		function addco(){
			//获取表单的数据
			//调用model中的addUser方法，添加到数据库中
			//var_dump($_POST);
			$data = $_POST;
			$model = new CoModel();
			$result = $model->addco($data);
			//如果成功，输出，转到列表页面
			if($result){
				echo '添加成功'.'<a href="Admin.php?c=co&m=cooperate">如果没有跳转，请点这里跳转</a>';
				header("refresh:3;Admin.php?c=co&m=cooperate = Admin.php?c=co&m=cooperate"); 
			}else{
				echo '失败';
				//获取表单的数据
			//调用model中的addUser方法，添加到数据库中
			//var_dump($_POST);

			}

		}
	}
 ?>
